import 'package:flutter/material.dart';
import 'package:flutter_demo/components/cu_navigation_bar/cu_navigation_bar.dart';
import 'package:flutter_demo/routers/router_paths.dart';
import 'package:go_router/go_router.dart';

class Home extends StatefulWidget {
  const Home({super.key});

  @override
  State<Home> createState() => _HomeState();
}

class _HomeState extends State<Home> {
  final Color _selectedColor = Colors.green;
  final double _selectedWidth = 300;
  final double _selectedHeight = 300;
  @override
  void initState() {
    // TODO: implement initState
    print("初始化了主页");
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('首页')),
      body: Center(
        child: AnimatedContainer(
          duration: Duration(milliseconds: 0),
          width: _selectedWidth,
          height: _selectedHeight,
          color: _selectedColor,
          child: Hero(
            tag: "image",
            child: GestureDetector(
              onTap: () {
                context.pushNamed(RouterPaths.homeDetail);
              },
              child: Image.network(
                width: _selectedWidth,
                height: _selectedHeight,
                fit: BoxFit.fill,
                "https://preview.qiantucdn.com/58pic/if/8c/UZ/ra/6bjfhndx1q0tukgv3ez2a84crm5wliy7_PIC2018.png!w1024_new_small_1",
              ),
            ),
          ),
        ),
      ),
      bottomNavigationBar: CuNavigationBar(),
    );
  }
}
